//
//  GetRowHeightTools.m
//  段子
//
//  Created by dllo on 16/6/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "GetRowHeightTools.h"

@implementation GetRowHeightTools


+(CGFloat)heightWith:(NSString *)text{
    
    NSDictionary *attribusDic = @{
                                  NSFontAttributeName: [UIFont systemFontOfSize:20]
                                  };
    
    CGRect rect = [text boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:attribusDic context:nil];
    
    
    return rect.size.height;
    
}


+(CGFloat)imageHeightWith:(NSString *)imageName{
    
    NSURL *url = [NSURL URLWithString:imageName];
    
    NSData *data = [NSData dataWithContentsOfURL:url];
    
    
    UIImage *image = [UIImage imageWithData:data];
    
    
    CGFloat height = image.size.height * [UIScreen mainScreen].bounds.size.width / image.size.width;
    
    
    return height;
    
    
}








@end
